<template>
  <div>
    <f-form ref='form' :action='api.payment' :form-key='this.formItem.paymentId' :handlerName='handlerName'>
      <div>
        <f-form-item label='结算金额' name='deptSettleAmount' disabled data-type='number' :required='true' :value.sync='formItem.deptSettleAmount' />
        <f-form-item label='备注' name='remark' :value='formItem.remark' />
      </div>
    </f-form>
  </div>
</template>
<script>

import api from "../../../../js/api"


export default {
  name: "SettleApply",
  components: {},
  data() {
    let me = this
    return {
      api: Object.assign(api, this.api),
      //列表初始化查询参数
      queryParam: {},
      loaded: false,
      handlerName: "hyDeptSettleApplyPaymentSaveHandler",
      saleManName: null,
      selectIds: "",
      formItem: this.getFormItem()
    }
  },
  created() {
  },
  computed: {},
  methods: {
    getFormItem() {
      return {
        totalSettleAmount: 0,
        remark: ""
      }
    },
    setData(data) {
      if (data.selectIds) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        this.selectIds = data.selectIds
        this.getSettleApplyInfo()
      }
    },
    /**
     * 获取支付信息
     */
    getSettleApplyInfo() {
      this.http.get(this, {
        url: this.api.payment.getDeptSettleApplyInfo,
        params: {
          settleIds: this.selectIds
        },
        success: (me, data) => {
          this.$nextTick(() => {
            this.formItem = data
            if (data.deptSettleAmount) {
              this.$refs.form.getForm().setFieldsValue({ "deptSettleAmount": data.deptSettleAmount })
            } else {
              this.$refs.form.getForm().setFieldsValue({ "deptSettleAmount": null })
              this.formItem.deptSettleAmount = null
            }
            this.$forceUpdate()
          })
        }
      })
    },
    handleSubmit() {
      this.$refs["form"].submit({
        selectIds: this.selectIds
      }, this.handleSuccess)
    },
    handleSuccess() {
      this.$emit("closeDrawer", false)
    }
  }
}
</script>
